#!/bin/sh -efu

gear_rules_archive_tree_name() # test entry point
{
	local spec=file.spec
	local n=foo
	local v=1
	local r=2
	local dir=a
	local name=$n-$dir-$v-$r
	local result

	printf 'Name:%s\nVersion: %s\nRelease:	%s' "$n" "$v" "$r" >"$spec"
	mkdir -p .gear "$dir/b/c"
	echo "test $gear_directive" >"$dir/b/c/file"
	printf '%s\n' "$gear_directive: $dir name=@name@-@dir@-@version@-@release@" >.gear/rules
	git add "$spec" .gear "$dir"
	git commit -q -a -m 1

	finalize_repo

	$GEAR "$GEAR_OUT"
	check_pkgtar_list "$spec
./
./$spec
./$name.$gear_directive"
	check_pkgtar_spec "$GEAR_OUT" "$spec"
	unpack_pkgtar_to .out
	check_archive_list .out/"$name.$gear_directive" "$name/
$name/b/
$name/b/c/
$name/b/c/file"
	unpack_archive_into .out/"$name.$gear_directive" .out2
	result="$(cat -- ".out2/$name/b/c/file")"
	assertEquals "test $gear_directive" "$result"
}
